package com.hsd.znsh.repository;

import com.hsd.znsh.entity.User;
import com.hsd.znsh.entity.UserRole;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/*
 * @auther: wangjiacai
 *
 * @create: 2018-04-23 11:54:50
 */
public interface UserRoleRepository extends JpaRepository<UserRole, Integer> {

    @Query("select roleId from UserRole where userId=?1 ")
    List<Integer> findRoleIdListByUserId(Integer userId);

    UserRole findByUserId(Integer userId);

    void deleteByRoleId(Integer roleId);

    void deleteByUserId(Integer userId);
}
